<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>健康饮食打卡</title>
  <style>
    body {
      background-color: #f4f4f4;
      padding: 20px;
    }

    label {
      margin-bottom: 5px;
    }

    input,
    select {
      width: 200px;
      padding: 10px;
      margin-bottom: 15px;
      border: 1px solid #ccc;
    }

    button {
      background-color: #007BFF;
      color: white;
      padding: 10px 20px;
      border: none;
    }

    #recordDisplay {
      background-color: white;
      margin-top: 20px;
      padding: 10px;
      border: 1px solid #ccc;
    }

    #recordDisplay ul {
      list-style: none;
      padding: 0;
    }

    #recordDisplay li {
      margin-bottom: 5px;
    }
  </style>
</head>

<body>
  <h1>健康饮食打卡</h1>
  <label for="datePicker">日期：</label>
  <input type="date" id="datePicker">
  <label for="mealSelect">用餐时段：</label>
  <select id="mealSelect">
    <option value="">请选择</option>
    <option value="早餐">早餐</option>
    <option value="午餐">午餐</option>
    <option value="晚餐">晚餐</option>
  </select>
  <label for="foodInput">食物：</label>
  <input type="text" id="foodInput">
  <span id="foodInputError" style="color: red; display: none;"></span>
  <button id="submitBtn">提交打卡</button>
  <div id="recordDisplay"></div>

  <script>
    window.onload = function () {
      // 获取页面上各个元素
      const datePicker = document.getElementById('datePicker');
      const mealSelect = document.getElementById('mealSelect');
      const foodInput = document.getElementById('foodInput');
      const submitBtn = document.getElementById('submitBtn');
      const recordDisplay = document.getElementById('recordDisplay');
      const foodInputError = document.getElementById('foodInputError');
      const dietRecords = [];
    };
  </script>
</body>

</html>